:root {
  --primary-color: #5b6abf;
  --secondary-color: #9c64a6;
  --accent-color: #6a5acd;
  --light-color: #e6e6fa;
  --success-color: #4caf50;
  --error-color: #f44336;
  --text-color: #2c3e50;
  --white: #ffffff;
}

/* Header Styles */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 0 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #fff;
  transition: all 0.3s ease;
}

.header:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.logo {
  font-size: 28px;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--white);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 1px;
}

.navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header .navigation ul li {
  float: left;
  position: relative;
}

.header .navigation ul li a {
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  padding: 22px 20px;
  display: block;
  transition: all 0.3s ease;
}

.header .navigation ul li a:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

#toggle,
.header label {
  display: none;
  cursor: pointer;
}

.menu {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

@media (max-width: 950px) {
  .header label {
    display: initial;
  }

  .header {
    padding: 15px 10%;
  }

  .header .navigation {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    border-radius: 0 0 12px 12px;
  }

  .header .navigation ul li {
    width: 100%;
  }

  .header .navigation ul li a {
    padding: 12px 20px;
  }

  #toggle:checked ~ .navigation {
    display: block;
    animation: slideDown 0.4s ease-out;
  }
}

/* Body and Background Styles */
body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #b7f7ff, #d2bcfc, #ade5ff);
  margin: 0;
  padding: 0;
  padding-top: 80px;
  min-height: 100vh;
  color: var(--text-color);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

/* Background Animation */
@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Main Container */
.container {
  max-width: 1100px;
  width: 90%;
  margin: 20px auto;
  padding: 30px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 25px;
  font-family: "Montserrat", sans-serif;
}

.instructions {
  background-color: rgba(230, 230, 250, 0.3);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  border-left: 4px solid var(--secondary-color);
}

.instructions h2 {
  color: var(--secondary-color);
  margin-top: 0;
  font-size: 22px;
}

/* Word Search */
.puzzle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
}

.word-search {
  border-collapse: collapse;
  margin: 20px 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  overflow: hidden;
}

.word-search td {
  width: 45px;
  height: 45px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: bold;
  border: 2px solid #bbdefb;
  background-color: white;
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
}

.word-search td.selected {
  background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.word-search td.found {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Word List */
.word-list-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
}

.word-card {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  padding: 15px 25px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.word-card.found {
  background: linear-gradient(135deg, var(--success-color), #27ae60);
  text-decoration: line-through;
  opacity: 0.9;
  transform: scale(0.95);
}

.word-card i {
  font-size: 1.4rem;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

button {
  padding: 15px 30px;
  font-size: 1.2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}

#check-btn {
  background: linear-gradient(135deg, var(--success-color), #27ae60);
  color: white;
}

#check-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

#reset-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

#reset-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Messages */
.message {
  margin-top: 20px;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  font-weight: bold;
  font-size: 1.3rem;
  display: none;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.success {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  color: #155724;
  border: 2px solid #c3e6cb;
}

.info {
  background: linear-gradient(135deg, #d1ecf1, #bee5eb);
  color: #0c5460;
  border: 2px solid #bee5eb;
}

/* Counter */
.counter {
  text-align: center;
  font-size: 1.4rem;
  margin-top: 20px;
  color: var(--primary-color);
  font-weight: bold;
  background: rgba(255, 255, 255, 0.8);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  .controls {
    flex-direction: column;
  }

  .word-search td {
    width: 35px;
    height: 35px;
    font-size: 1.1rem;
  }

  .word-card {
    padding: 10px 15px;
    font-size: 1rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  button {
    width: 100%;
    justify-content: center;
  }
}
